package atm;

/**
 * 存取款口类
 * @author 莫东林
 * @version 2018/11/16
 */
public class MoneyBox {
	
	//系统启动，存取款口默认为关闭状态  0：关闭 1：等待放款状态 2：等待取款状态
	private int state = 0;
	
	//存取款操作时对应的金额
	private Double money = 0.00;
	
	/**
	 * 进入关闭状态
	 */
	public void enterClose(){
		state = 0;
		money = 0.00;
	}

	/**
	 * 进入存款状态
	 */
	public void enterPutMoneyState(){
		state = 1;
	}
	
	/**
	 * 进入取款状态
	 */
	public void enterGetMoneyState(Double money){
		state = 2;
		this.money = money;
	}

	@Override
	public String toString() {
		String output = "{";
		output += "\"state\":" + this.state;
		output += ",";
		output += "\"money\":\"" + this.money +  "\"";
		output += "}";
		return output;
	}

	
}
